package com.gw.detail.controllor.detail;

import java.util.List;

import com.gw.detail.domain.Verlueb;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.gw.detail.service.IVerluebService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 伤情概述Controller
 * 
 * @author WangBin
 * @date 2021-04-30
 */
@RestController
@RequestMapping("/detail/verlueb")
public class VerluebController extends BaseController
{
    @Autowired
    private IVerluebService verluebService;

    /**
     * 查询伤情概述列表
     */
    @PreAuthorize("@ss.hasPermi('detail:verlueb:list')")
    @GetMapping("/list")
    public TableDataInfo list(Verlueb verlueb)
    {
        startPage();
        List<Verlueb> list = verluebService.selectVerluebList(verlueb);
        return getDataTable(list);
    }

    /**
     * 导出伤情概述列表
     */
    @PreAuthorize("@ss.hasPermi('detail:verlueb:export')")
    @Log(title = "伤情概述", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Verlueb verlueb)
    {
        List<Verlueb> list = verluebService.selectVerluebList(verlueb);
        ExcelUtil<Verlueb> util = new ExcelUtil<Verlueb>(Verlueb.class);
        return util.exportExcel(list, "伤情概述数据");
    }

    /**
     * 获取伤情概述详细信息
     */
    @PreAuthorize("@ss.hasPermi('detail:verlueb:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(verluebService.selectVerluebById(id));
    }

    /**
     * 新增伤情概述
     */
    @PreAuthorize("@ss.hasPermi('detail:verlueb:add')")
    @Log(title = "伤情概述", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Verlueb verlueb)
    {
        return toAjax(verluebService.insertVerlueb(verlueb));
    }

    /**
     * 修改伤情概述
     */
    @PreAuthorize("@ss.hasPermi('detail:verlueb:edit')")
    @Log(title = "伤情概述", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Verlueb verlueb)
    {
        return toAjax(verluebService.updateVerlueb(verlueb));
    }

    /**
     * 删除伤情概述
     */
    @PreAuthorize("@ss.hasPermi('detail:verlueb:remove')")
    @Log(title = "伤情概述", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(verluebService.deleteVerluebByIds(ids));
    }
}
